-
Notifications
You must be signed in to change notification settings - Fork 1
V2 파일명 수정 #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V2 파일명 수정 #39
Conversation
dependency submission code removed
merging main retry
WalkthroughThis change removes all "V2" (version 2) controller, service, and repository classes, reverting the codebase to use the original, non-versioned components throughout the main and test code. All relevant package declarations, imports, class names, and field types have been updated accordingly to reference the non-V2 versions. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Controller
participant Service
participant Repository
Client->>Controller: Sends Request
Controller->>Service: Delegates business logic
Service->>Repository: Fetches or updates data
Repository-->>Service: Returns data/result
Service-->>Controller: Returns processed data
Controller-->>Client: Returns response
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 22
🔭 Outside diff range comments (23)
src/main/java/com/example/Jinus/service/cafeteria/CafeteriaService.java (3)
22-22: 🛠️ Refactor suggestionUpdate field reference
Update this reference to the renamed field.
- return campusResponseServiceV2.makeCampusListCard(); + return campusResponseService.makeCampusListCard();
28-28: 🛠️ Refactor suggestionUpdate field reference
Update this reference to the renamed field.
- : campusResponseServiceV2.makeCampusListCard(); // 존재 X -> 캠퍼스 정보 반환 + : campusResponseService.makeCampusListCard(); // 존재 X -> 캠퍼스 정보 반환
33-35: 🛠️ Refactor suggestionUpdate all field references
Update these references to the renamed fields.
- String campusName = campusServiceV2.getUserCampusName(campusId); - List<CafeteriaDto> cafeteriaList = cacheServiceV2.getCafeteriaList(campusId); - return cafeteriaResponseServiceV2.createCafeteriaListCard(campusName, cafeteriaList); + String campusName = campusService.getUserCampusName(campusId); + List<CafeteriaDto> cafeteriaList = cacheService.getCafeteriaList(campusId); + return cafeteriaResponseService.createCafeteriaListCard(campusName, cafeteriaList);src/test/java/com/example/Jinus/service/userInfo/UserServiceTest.java (4)
32-33: 🛠️ Refactor suggestionUpdate field references after renaming
After updating the field names, you'll need to update this reference as well.
- Mockito.when(userRepositoryV2.findCampusIdById(kakaoId)).thenReturn(Optional.of(campusId)); // Mocking - int result = userServiceV2.getUserCampusId(kakaoId); + Mockito.when(userRepository.findCampusIdById(kakaoId)).thenReturn(Optional.of(campusId)); // Mocking + int result = userService.getUserCampusId(kakaoId);
46-47: 🛠️ Refactor suggestionUpdate field references after renaming
After updating the field names, you'll need to update this reference as well.
- Mockito.when(userRepositoryV2.findCampusIdById(kakaoId)).thenReturn(Optional.empty()); // Mocking - int result = userServiceV2.getUserCampusId(kakaoId); + Mockito.when(userRepository.findCampusIdById(kakaoId)).thenReturn(Optional.empty()); // Mocking + int result = userService.getUserCampusId(kakaoId);
61-62: 🛠️ Refactor suggestionUpdate field references after renaming
After updating the field names, you'll need to update this reference as well.
- Mockito.when(userRepositoryV2.findDepartmentIdById(kakaoId)).thenReturn(Optional.of(departmentId)); - int result = userServiceV2.getUserDepartmentId(kakaoId); + Mockito.when(userRepository.findDepartmentIdById(kakaoId)).thenReturn(Optional.of(departmentId)); + int result = userService.getUserDepartmentId(kakaoId);
75-76: 🛠️ Refactor suggestionUpdate field references after renaming
After updating the field names, you'll need to update this reference as well.
- Mockito.when(userRepositoryV2.findDepartmentIdById(kakaoId)).thenReturn(Optional.empty()); - int result = userServiceV2.getUserDepartmentId(kakaoId); + Mockito.when(userRepository.findDepartmentIdById(kakaoId)).thenReturn(Optional.empty()); + int result = userService.getUserDepartmentId(kakaoId);src/main/java/com/example/Jinus/controller/NoticeController.java (3)
31-31: 🛠️ Refactor suggestionUpdate field reference after renaming
After updating the field names, you'll need to update this reference as well.
- return noticeServiceV2.existUserReturnNotice(departmentEng, departmentId); + return noticeService.existUserReturnNotice(departmentEng, departmentId);
39-41: 🛠️ Refactor suggestionUpdate field references after renaming
After updating the field names, you'll need to update these references as well.
- int departmentId = userServiceV2.getUserDepartmentId(userId); // 학과 영문명 찾기 - String departmentEng = departmentServiceV2.getDepartmentEng(departmentId); + int departmentId = userService.getUserDepartmentId(userId); // 학과 영문명 찾기 + String departmentEng = departmentService.getDepartmentEng(departmentId);
44-46: 🛠️ Refactor suggestionUpdate field references after renaming
After updating the field names, you'll need to update these references as well.
- return noticeServiceV2.existUserReturnNotice(departmentEng, departmentId); } else { - return noticeServiceV2.doesNotExistUserReturnBlock(); + return noticeService.existUserReturnNotice(departmentEng, departmentId); } else { + return noticeService.doesNotExistUserReturnBlock();src/main/java/com/example/Jinus/controller/DietController.java (1)
19-19: 🛠️ Refactor suggestionUpdate field reference after renaming
After updating the field name, you'll need to update this reference as well.
- return dietServiceV2.requestHandler(requestDto); + return dietService.requestHandler(requestDto);src/test/java/com/example/Jinus/service/cafeteria/CampusServiceTest.java (2)
34-35: 🛠️ Refactor suggestionUpdate variable references to match renamed fields
These references need to be updated to match the renamed fields without the V2 suffix.
// when - Mockito.when(campusRepositoryV2.findCampusNameByCampusId(campusId)).thenReturn(campusName); // Mocking - String result = campusServiceV2.getUserCampusName(campusId); + Mockito.when(campusRepository.findCampusNameByCampusId(campusId)).thenReturn(campusName); // Mocking + String result = campusService.getUserCampusName(campusId);
50-51: 🛠️ Refactor suggestionUpdate variable references to match renamed fields
These references need to be updated to match the renamed fields without the V2 suffix.
// when - Mockito.when(campusRepositoryV2.findCampusList()).thenReturn(campusList); - List<CampusEntity> result = campusServiceV2.getCampusList(); + Mockito.when(campusRepository.findCampusList()).thenReturn(campusList); + List<CampusEntity> result = campusService.getCampusList();src/test/java/com/example/Jinus/service/userInfo/DepartmentServiceTest.java (1)
29-30: 🛠️ Refactor suggestionUpdate variable references to match renamed fields
These references need to be updated to match the renamed fields without the V2 suffix.
// when - Mockito.when(departmentRepositoryV2.findDepartmentEngById(id)).thenReturn(eng); - String result = departmentServiceV2.getDepartmentEng(id); + Mockito.when(departmentRepository.findDepartmentEngById(id)).thenReturn(eng); + String result = departmentService.getDepartmentEng(id);src/main/java/com/example/Jinus/service/cafeteria/CafeteriaQueryService.java (2)
20-22: 🛠️ Refactor suggestionUpdate repository reference to match renamed field
This reference needs to be updated to match the renamed repository field without the V2 suffix.
public int getCafeteriaId(String cafeteriaName, int campusId) { - return cafeteriaRepositoryV2.findCafeteriaId(cafeteriaName, campusId).orElse(-1); + return cafeteriaRepository.findCafeteriaId(cafeteriaName, campusId).orElse(-1); }
28-30: 🛠️ Refactor suggestionUpdate repository reference to match renamed field
This reference needs to be updated to match the renamed repository field without the V2 suffix.
public String getImgUrl(int cafeteriaId) { - return cafeteriaRepositoryV2.findImgUrlByCafeteriaId(cafeteriaId); + return cafeteriaRepository.findImgUrlByCafeteriaId(cafeteriaId); }src/test/java/com/example/Jinus/service/cafeteria/CafeteriaServiceTest.java (1)
38-39: 🛠️ Refactor suggestionUpdate variable references to match renamed fields
These references need to be updated to match the renamed fields without the V2 suffix.
// when - Mockito.when(cafeteriaRepositoryV2.findCafeteriaListByCampusId(campusId)).thenReturn(resultList); - List<CafeteriaDto> result = cacheServiceV2.getCafeteriaList(campusId); + Mockito.when(cafeteriaRepository.findCafeteriaListByCampusId(campusId)).thenReturn(resultList); + List<CafeteriaDto> result = cacheService.getCafeteriaList(campusId);src/main/java/com/example/Jinus/service/cafeteria/CacheService.java (2)
27-41: 🛠️ Refactor suggestionMethod still references v2-named variables
This method references
dietRepositoryV2which should be updated to match the non-V2 naming scheme.public List<DietDto> getDietList(HandleRequestDto parameters, int cafeteriaId) { String key = parameters.getDietDate() + "::" + parameters.getPeriod() + "::" + cafeteriaId; List<DietDto> cached = (List<DietDto>) redisConfig.redisTemplate().opsForValue().get(key); if (cached != null) return cached; - List<DietDto> result = dietRepositoryV2.findDietList(parameters.getDietDate(), parameters.getPeriod(), cafeteriaId); + List<DietDto> result = dietRepository.findDietList(parameters.getDietDate(), parameters.getPeriod(), cafeteriaId); if (result != null && !result.isEmpty()) { long ttlSeconds = calculateTtlUntilNextMidnight(parameters.getDietDate()); redisConfig.redisTemplate().opsForValue().set(key, result, Duration.ofSeconds(ttlSeconds)); } return result; }
56-64: 🛠️ Refactor suggestionCafeteria list method still references v2-named variable
The
getCafeteriaListmethod refers tocafeteriaRepositoryV2which should be updated to match the non-V2 naming convention.@Cacheable( value = "cafeteriaList", key = "#p0", cacheManager = "contentCacheManager") public List<CafeteriaDto> getCafeteriaList(int campusId) { - return cafeteriaRepositoryV2.findCafeteriaListByCampusId(campusId); + return cafeteriaRepository.findCafeteriaListByCampusId(campusId); }src/main/java/com/example/Jinus/service/diet/DietQueryService.java (1)
28-28: 🛠️ Refactor suggestionMethod still references v2-named variable
This method references
cacheServiceV2which should be updated to match the non-V2 naming scheme.- List<DietDto> dietDtos = cacheServiceV2.getDietList(parameters, cafeteriaId); + List<DietDto> dietDtos = cacheService.getDietList(parameters, cafeteriaId);src/main/java/com/example/Jinus/service/diet/DietParameterService.java (2)
53-53: 🛠️ Refactor suggestionMethod still references v2-named variable
This method references
userServiceV2which should be updated to match the non-V2 naming scheme.- int campusId = userServiceV2.getUserCampusId(kakaoId); + int campusId = userService.getUserCampusId(kakaoId);
56-56: 🛠️ Refactor suggestionMethod still references v2-named variable
This method references
campusServiceV2which should be updated to match the non-V2 naming scheme.- return campusServiceV2.getUserCampusName(campusId); + return campusService.getUserCampusName(campusId);src/main/java/com/example/Jinus/service/diet/DietService.java (1)
34-34: 🛠️ Refactor suggestionUpdate all service variable references throughout the methods.
In addition to updating the field declarations, you'll need to update all references to these variables throughout the class methods. Here are some examples:
- HandleRequestDto parameters = dietParameterServiceV2.setParameters(kakaoId, time, requestDto); + HandleRequestDto parameters = dietParameterService.setParameters(kakaoId, time, requestDto); - int campusId = campusServiceV2.getCampusId(parameters.getCampusName()); - int cafeteriaId = cafeteriaQueryServiceV2.getCafeteriaId(parameters.getCafeteriaName(), campusId); + int campusId = campusService.getCampusId(parameters.getCampusName()); + int cafeteriaId = cafeteriaQueryService.getCafeteriaId(parameters.getCafeteriaName(), campusId); - return dietResponseServiceV2.errorMsgThereIsNoCafeteria(); + return dietResponseService.errorMsgThereIsNoCafeteria(); - String diets = dietQueryServiceV2.getDietResponse(parameters, cafeteriaId); + String diets = dietQueryService.getDietResponse(parameters, cafeteriaId); - String imgUrl = cafeteriaQueryServiceV2.getImgUrl(cafeteriaId); + String imgUrl = cafeteriaQueryService.getImgUrl(cafeteriaId); - return dietResponseServiceV2.mappingResponse(parameters, imgUrl, title, description); + return dietResponseService.mappingResponse(parameters, imgUrl, title, description);Consider using your IDE's refactoring tools to ensure all references are updated consistently.
Also applies to: 41-42, 46-46, 49-49, 57-57, 72-72
🧹 Nitpick comments (2)
src/test/java/com/example/Jinus/repository/cafeteria/CampusRepositoryTest.java (1)
27-27: Consider updating the field name for consistency.While the repository type has been updated to
CampusRepository, the field namecampusRepositoryV2still contains the V2 suffix. Consider renaming the field tocampusRepositoryfor consistency with the type name.- private CampusRepository campusRepositoryV2; + private CampusRepository campusRepository;This would require updating all references to this field throughout the test class (lines 31, 32, 33, 44, 60).
src/test/java/com/example/Jinus/repository/userInfo/DepartmentRepostoryTest.java (1)
19-19: Fix typo in class nameThere's a typo in the class name: "Repostory" instead of "Repository". This should be corrected for consistency and proper naming.
-public class DepartmentRepostoryTest { +public class DepartmentRepositoryTest {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (38)
src/main/java/com/example/Jinus/controller/CafeteriaController.java(2 hunks)src/main/java/com/example/Jinus/controller/DietController.java(2 hunks)src/main/java/com/example/Jinus/controller/NoticeController.java(2 hunks)src/main/java/com/example/Jinus/repository/cafeteria/CafeteriaRepository.java(1 hunks)src/main/java/com/example/Jinus/repository/cafeteria/CampusRepository.java(2 hunks)src/main/java/com/example/Jinus/repository/cafeteria/DietRepository.java(2 hunks)src/main/java/com/example/Jinus/repository/notice/CategoryRepository.java(2 hunks)src/main/java/com/example/Jinus/repository/notice/NoticeRepository.java(2 hunks)src/main/java/com/example/Jinus/repository/userInfo/DepartmentRepository.java(2 hunks)src/main/java/com/example/Jinus/repository/userInfo/UserRepository.java(2 hunks)src/main/java/com/example/Jinus/service/cafeteria/CacheService.java(2 hunks)src/main/java/com/example/Jinus/service/cafeteria/CafeteriaQueryService.java(2 hunks)src/main/java/com/example/Jinus/service/cafeteria/CafeteriaResponseService.java(2 hunks)src/main/java/com/example/Jinus/service/cafeteria/CafeteriaService.java(2 hunks)src/main/java/com/example/Jinus/service/cafeteria/CampusResponseService.java(2 hunks)src/main/java/com/example/Jinus/service/cafeteria/CampusService.java(2 hunks)src/main/java/com/example/Jinus/service/diet/DietParameterService.java(2 hunks)src/main/java/com/example/Jinus/service/diet/DietQueryService.java(1 hunks)src/main/java/com/example/Jinus/service/diet/DietResponseService.java(2 hunks)src/main/java/com/example/Jinus/service/diet/DietService.java(2 hunks)src/main/java/com/example/Jinus/service/notice/CategoryService.java(1 hunks)src/main/java/com/example/Jinus/service/notice/NoticeService.java(2 hunks)src/main/java/com/example/Jinus/service/userInfo/DepartmentService.java(1 hunks)src/main/java/com/example/Jinus/service/userInfo/UserService.java(2 hunks)src/test/java/com/example/Jinus/controller/CafeteriaControllerTest.java(1 hunks)src/test/java/com/example/Jinus/repository/cafeteria/CafeteriaRepositoryTest.java(1 hunks)src/test/java/com/example/Jinus/repository/cafeteria/CampusRepositoryTest.java(1 hunks)src/test/java/com/example/Jinus/repository/notice/NoticeCategoryRepositoryTest.java(1 hunks)src/test/java/com/example/Jinus/repository/notice/NoticeRepositoryTest.java(1 hunks)src/test/java/com/example/Jinus/repository/userInfo/DepartmentRepostoryTest.java(1 hunks)src/test/java/com/example/Jinus/repository/userInfo/UserRepositoryTest.java(2 hunks)src/test/java/com/example/Jinus/service/cafeteria/CafeteriaServiceTest.java(1 hunks)src/test/java/com/example/Jinus/service/cafeteria/CampusServiceTest.java(2 hunks)src/test/java/com/example/Jinus/service/notice/CategoryServiceTest.java(2 hunks)src/test/java/com/example/Jinus/service/notice/NoticeServiceTest.java(2 hunks)src/test/java/com/example/Jinus/service/userInfo/DepartmentServiceTest.java(2 hunks)src/test/java/com/example/Jinus/service/userInfo/UserServiceHikariCPTest.java(1 hunks)src/test/java/com/example/Jinus/service/userInfo/UserServiceTest.java(2 hunks)
🔇 Additional comments (25)
src/main/java/com/example/Jinus/repository/userInfo/UserRepository.java (1)
1-12: Successful interface rename and package migration.The change from
UserRepositoryV2toUserRepositoryand the corresponding package update is consistent with the PR's goal of removing V2 class naming.src/main/java/com/example/Jinus/repository/userInfo/DepartmentRepository.java (1)
1-10: Interface rename and package change implemented correctly.The change from
DepartmentRepositoryV2toDepartmentRepositoryand the corresponding package update aligns with the PR's overall V2 naming removal strategy.src/test/java/com/example/Jinus/service/userInfo/UserServiceHikariCPTest.java (1)
23-23: Service dependency type updated correctly.The service reference has been properly updated from
UserServiceV2toUserService, which is consistent with the V2 naming removal.src/test/java/com/example/Jinus/repository/cafeteria/CampusRepositoryTest.java (1)
24-24: Test class renamed successfully.The test class name has been properly updated from
CampusRepositoryV2TesttoCampusRepositoryTest.src/main/java/com/example/Jinus/service/cafeteria/CafeteriaResponseService.java (1)
1-1: Class and package successfully renamed.The class has been properly renamed from
CafeteriaResponseServiceV2toCafeteriaResponseServiceand moved from thev2package structure to the standard package hierarchy, which aligns with the PR objective of removing V2 suffixes from class names.Also applies to: 19-19
src/main/java/com/example/Jinus/repository/notice/NoticeRepository.java (2)
1-1: Interface successfully renamed and relocated.The interface has been properly renamed from
NoticeRepositoryV2toNoticeRepositoryand moved from thev2package structure to the standard package hierarchy, which aligns with the PR objective.Also applies to: 10-10
11-13: Verify JPQL query compatibility.The query includes a
LIMIT 4clause which may not be standard JPQL syntax (it's typically SQL-specific). This could cause issues depending on your JPA implementation and database.Consider using Spring Data's pagination features instead:
- @Query("SELECT n FROM NoticeEntity n WHERE n.categoryId = :categoryId " + - "ORDER BY n.createdAt DESC LIMIT 4") - List<NoticeEntity> findNoticeListByCategoryId(@Param("categoryId")int categoryId); + @Query("SELECT n FROM NoticeEntity n WHERE n.categoryId = :categoryId " + + "ORDER BY n.createdAt DESC") + List<NoticeEntity> findTop4NoticeListByCategoryId(@Param("categoryId") int categoryId, Pageable pageable);Then use it with:
// In service class List<NoticeEntity> notices = noticeRepository.findTop4NoticeListByCategoryId(categoryId, PageRequest.of(0, 4));Alternatively, you could use the derived method name approach:
List<NoticeEntity> findTop4ByCategoryIdOrderByCreatedAtDesc(int categoryId);src/main/java/com/example/Jinus/service/diet/DietResponseService.java (1)
1-1: Class renamed and package structure updated.The class has been properly renamed from
DietResponseServiceV2toDietResponseService. Note that the package has changed fromcom.example.Jinus.service.v2.cafeteriatocom.example.Jinus.service.diet, which reflects both the removal of the v2 segment and an appropriate move from cafeteria to diet package.Also applies to: 15-15
src/main/java/com/example/Jinus/repository/cafeteria/CampusRepository.java (1)
1-12: Changes look good: Package and interface renaming consistent with PR objectives.The repository interface has been successfully renamed from
CampusRepositoryV2toCampusRepositoryand moved from thev2package hierarchy to the standard repository structure. This aligns with the PR's goal of removing V2 designations from filenames.src/main/java/com/example/Jinus/repository/notice/CategoryRepository.java (1)
1-10: Proper renaming of repository interface and package.The interface has been correctly renamed from
CategoryRepositoryV2toCategoryRepositoryand moved to the appropriate non-versioned package structure. This change maintains consistency with the other repository refactoring.src/test/java/com/example/Jinus/service/notice/CategoryServiceTest.java (1)
4-24: Test class properly updated to reflect non-versioned components.The test class has been successfully updated with the correct import for
CategoryRepositoryand renamed fromCategoryServiceV2TesttoCategoryServiceTest. The mock and inject annotations now properly reference the non-versioned components, ensuring test coverage is maintained during this refactoring.src/main/java/com/example/Jinus/repository/cafeteria/DietRepository.java (1)
1-14: Repository interface renamed and moved to standard package structure.The interface has been properly renamed from
DietRepositoryV2toDietRepositoryand relocated from the versioned package to the standard repository package. This change is consistent with the overall refactoring goal of removing V2 designations from filenames.src/main/java/com/example/Jinus/repository/cafeteria/CafeteriaRepository.java (1)
1-12: Package and interface name changes look goodThe changes removing the "V2" suffix from the interface name and updating the package path are consistent with the PR objectives to revert to non-versioned components.
src/test/java/com/example/Jinus/repository/cafeteria/CafeteriaRepositoryTest.java (1)
25-25: Class name correctly updated to remove 'V2'The test class name has been appropriately changed from
CafeteriaRepositoryV2TesttoCafeteriaRepositoryTestto reflect the removal of version suffixes.src/main/java/com/example/Jinus/service/cafeteria/CampusResponseService.java (2)
1-1: Package updated to remove 'v2' subdirectoryThe package declaration has been correctly updated to remove the 'v2' subdirectory.
18-18: Class name correctly updated to remove 'V2'The service class name has been appropriately changed from
CampusResponseServiceV2toCampusResponseServiceto match the removal of version suffixes.src/test/java/com/example/Jinus/repository/notice/NoticeCategoryRepositoryTest.java (2)
24-24: Class name correctly updated to remove 'V2'The test class name has been properly changed from
NoticeCategoryRepositoryV2TesttoNoticeCategoryRepositoryTestto align with the removal of version suffixes.
27-27: Repository field type correctly updatedThe field type has been correctly updated from
CategoryRepositoryV2toCategoryRepository, while maintaining the same variable namenoticeCategoryRepository.src/main/java/com/example/Jinus/service/userInfo/DepartmentService.java (4)
1-1: Package updated to remove 'v2' subdirectoryThe package declaration has been correctly updated to remove the 'v2' subdirectory.
3-3: Import updated to reference non-versioned repositoryThe import statement has been properly updated to reference the non-versioned
DepartmentRepositoryinstead ofDepartmentRepositoryV2.
9-9: Class name correctly updated to remove 'V2'The service class name has been appropriately changed from
DepartmentServiceV2toDepartmentServiceto match the removal of version suffixes.
11-11: Field type correctly updatedThe field type has been properly updated from
DepartmentRepositoryV2toDepartmentRepository, while maintaining a consistent variable name.src/test/java/com/example/Jinus/controller/CafeteriaControllerTest.java (1)
33-46: Test method needs updatingThe test method is incomplete and doesn't make assertions. Make sure to update any references to the V2-suffixed mock variables in the test method's implementation once it's completed.
src/main/java/com/example/Jinus/service/notice/CategoryService.java (1)
12-14: Good job on consistent naming here!Unlike some of the other files, this service class has consistent naming between the class name and field name. The field
noticeCategoryRepositorydoesn't include any V2 suffix, which is good.src/main/java/com/example/Jinus/controller/CafeteriaController.java (1)
21-21: Verify if API endpoint should retain "v2" in the path.While internal class names are being updated to remove "V2" suffixes, I notice the API endpoint still includes "/v2/" in its path. Should this also be updated for consistency, or is this intentional API versioning that should remain as is?
| @ActiveProfiles("test") // application-test.properties 적용 | ||
| @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.ANY) // H2 사용 | ||
| public class UserRepositoryV2Test { | ||
| public class UserRepositoryTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Variable name inconsistent with interface type.
While the class has been correctly renamed and the field type updated to UserRepository, the variable name userRepositoryV2 still contains the V2 suffix. This creates inconsistency between the type and variable name, which could lead to confusion.
- private UserRepository userRepositoryV2;
+ private UserRepository userRepository;Additionally, all references to this variable throughout the test methods will need to be updated.
Also applies to: 31-31
|
|
||
| @Autowired | ||
| NoticeRepositoryV2 noticeRepositoryV2; | ||
| NoticeRepository noticeRepositoryV2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Update the field name to match naming pattern
While the class name has been updated to remove the "V2" suffix, the field name still contains "V2". For consistency, you should rename the field to match the class name pattern.
- NoticeRepository noticeRepositoryV2;
+ NoticeRepository noticeRepository;Make sure to update all references to this field in the test methods below.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| NoticeRepository noticeRepositoryV2; | |
| NoticeRepository noticeRepository; |
| private final CampusService campusServiceV2; | ||
| private final CampusResponseService campusResponseServiceV2; | ||
| private final CacheService cacheServiceV2; | ||
| private final CafeteriaResponseService cafeteriaResponseServiceV2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Update field names to match class naming pattern
While the service types have been updated to remove the "V2" suffix, all field names still contain "V2". For consistency with the class naming changes, you should update all field names to remove the "V2" suffix.
- private final CampusService campusServiceV2;
- private final CampusResponseService campusResponseServiceV2;
- private final CacheService cacheServiceV2;
- private final CafeteriaResponseService cafeteriaResponseServiceV2;
+ private final CampusService campusService;
+ private final CampusResponseService campusResponseService;
+ private final CacheService cacheService;
+ private final CafeteriaResponseService cafeteriaResponseService;Don't forget to update all references to these fields throughout the class methods.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private final CampusService campusServiceV2; | |
| private final CampusResponseService campusResponseServiceV2; | |
| private final CacheService cacheServiceV2; | |
| private final CafeteriaResponseService cafeteriaResponseServiceV2; | |
| private final CampusService campusService; | |
| private final CampusResponseService campusResponseService; | |
| private final CacheService cacheService; | |
| private final CafeteriaResponseService cafeteriaResponseService; |
| } | ||
| @Autowired | ||
| private CafeteriaRepositoryV2 cafeteriaRepositoryV2; | ||
| private CafeteriaRepository cafeteriaRepositoryV2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Field type updated but variable name still contains 'V2'
While the type has been correctly updated from CafeteriaRepositoryV2 to CafeteriaRepository, the variable name cafeteriaRepositoryV2 still contains the V2 suffix, which is inconsistent with the class renaming pattern.
- private CafeteriaRepository cafeteriaRepositoryV2;
+ private CafeteriaRepository cafeteriaRepository;Additionally, you should update all references to this variable throughout the test class (lines 30, 47, 62).
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private CafeteriaRepository cafeteriaRepositoryV2; | |
| private CafeteriaRepository cafeteriaRepository; |
| public class CampusResponseService { | ||
|
|
||
| private final CampusServiceV2 campusServiceV2; | ||
| private final CampusService campusServiceV2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Field type updated but variable name still contains 'V2'
While the type has been correctly updated from CampusServiceV2 to CampusService, the variable name campusServiceV2 still contains the V2 suffix, which is inconsistent with the naming changes made to the classes.
- private final CampusService campusServiceV2;
+ private final CampusService campusService;Additionally, you should update all references to this variable throughout the class (line 24).
Committable suggestion skipped: line range outside the PR's diff.
| public class NoticeService { | ||
|
|
||
| private final NoticeRepositoryV2 noticeRepositoryV2; | ||
| private final CategoryServiceV2 categoryServiceV2; | ||
| private final NoticeRepository noticeRepositoryV2; | ||
| private final CategoryService categoryServiceV2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Variable names should also be updated to remove V2 suffix.
While the class names and import types have been updated to remove the "V2" suffix, the field variable names still contain "V2" (noticeRepositoryV2 and categoryServiceV2). This creates inconsistency in your code.
public class NoticeService {
- private final NoticeRepository noticeRepositoryV2;
- private final CategoryService categoryServiceV2;
+ private final NoticeRepository noticeRepository;
+ private final CategoryService categoryService;After making this change, you'll need to update all references to these variables throughout this class.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| public class NoticeService { | |
| private final NoticeRepositoryV2 noticeRepositoryV2; | |
| private final CategoryServiceV2 categoryServiceV2; | |
| private final NoticeRepository noticeRepositoryV2; | |
| private final CategoryService categoryServiceV2; | |
| public class NoticeService { | |
| private final NoticeRepository noticeRepository; | |
| private final CategoryService categoryService; |
| @InjectMocks | ||
| private NoticeServiceV2 noticeServiceV2; | ||
| private NoticeService noticeServiceV2; | ||
| @Mock | ||
| private CategoryServiceV2 categoryServiceV2; | ||
| private CategoryService categoryServiceV2; | ||
| @Mock | ||
| private NoticeRepositoryV2 noticeRepositoryV2; | ||
| private NoticeRepository noticeRepositoryV2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Test field names should also be updated to remove V2 suffix.
While the class names and types have been updated to remove "V2", the injected field names still contain "V2" (noticeServiceV2, categoryServiceV2, noticeRepositoryV2). This creates inconsistency between class names and variable names.
@InjectMocks
-private NoticeService noticeServiceV2;
+private NoticeService noticeService;
@Mock
-private CategoryService categoryServiceV2;
+private CategoryService categoryService;
@Mock
-private NoticeRepository noticeRepositoryV2;
+private NoticeRepository noticeRepository;After making this change, you'll need to update all references to these variables throughout the test class.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| @InjectMocks | |
| private NoticeServiceV2 noticeServiceV2; | |
| private NoticeService noticeServiceV2; | |
| @Mock | |
| private CategoryServiceV2 categoryServiceV2; | |
| private CategoryService categoryServiceV2; | |
| @Mock | |
| private NoticeRepositoryV2 noticeRepositoryV2; | |
| private NoticeRepository noticeRepositoryV2; | |
| @InjectMocks | |
| private NoticeService noticeService; | |
| @Mock | |
| private CategoryService categoryService; | |
| @Mock | |
| private NoticeRepository noticeRepository; |
| public class UserService { | ||
|
|
||
| private final UserRepositoryV2 userRepositoryV2; | ||
| private final UserRepository userRepositoryV2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Variable name should be updated to remove V2 suffix.
While the class names and import types have been updated to remove the "V2" suffix, the field variable name still contains "V2" (userRepositoryV2). This creates inconsistency in your code.
-private final UserRepository userRepositoryV2;
+private final UserRepository userRepository;After making this change, you'll need to update all references to this variable in the methods below.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private final UserRepository userRepositoryV2; | |
| private final UserRepository userRepository; |
| private final UserService userServiceV2; | ||
| private final CafeteriaService cafeteriaServiceV2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Update variable names to match their types.
The service field types have been updated to remove the V2 suffix, but the variable names still contain "V2" (userServiceV2 and cafeteriaServiceV2). For better consistency and readability, consider updating the variable names as well:
- private final UserService userServiceV2;
- private final CafeteriaService cafeteriaServiceV2;
+ private final UserService userService;
+ private final CafeteriaService cafeteriaService;Don't forget to update all references to these variables throughout the class.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private final UserService userServiceV2; | |
| private final CafeteriaService cafeteriaServiceV2; | |
| private final UserService userService; | |
| private final CafeteriaService cafeteriaService; |
| private final CampusService campusServiceV2; | ||
| private final CafeteriaQueryService cafeteriaQueryServiceV2; | ||
| private final DietParameterService dietParameterServiceV2; | ||
| private final DietResponseService dietResponseServiceV2; | ||
| private final DietQueryService dietQueryServiceV2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Update service variable names to match their types.
The service field types have been updated to remove the V2 suffix, but the variable names still contain "V2". For consistency and readability, consider updating the variable names:
- private final CampusService campusServiceV2;
- private final CafeteriaQueryService cafeteriaQueryServiceV2;
- private final DietParameterService dietParameterServiceV2;
- private final DietResponseService dietResponseServiceV2;
- private final DietQueryService dietQueryServiceV2;
+ private final CampusService campusService;
+ private final CafeteriaQueryService cafeteriaQueryService;
+ private final DietParameterService dietParameterService;
+ private final DietResponseService dietResponseService;
+ private final DietQueryService dietQueryService;Remember to update all references to these variables throughout the class methods as well.
Summary by CodeRabbit
Refactor
Tests